#include "core.h"
#include "arch/dispatch.h"

ErrorCode matrix_multiply(const Matrix* a, const Matrix* b, Matrix** result) {
    // 参数检查...
    
    // 根据架构和CPU特性选择最优实现
    #if defined(ARCH_X86)
        if (cpu_supports_avx2()) {
            return matrix_multiply_avx2(a, b, result);
        } else if (cpu_supports_sse4()) {
            return matrix_multiply_sse4(a, b, result);
        }
    #elif defined(ARCH_ARM)
        if (cpu_supports_neon()) {
            return matrix_multiply_neon(a, b, result);
        } else if (cpu_supports_sve()) {
            return matrix_multiply_sve(a, b, result);
        }
    #endif
    
    // 回退到通用实现
    return matrix_multiply_generic(a, b, result);
}